<template>
  <view class="ad-block-comp" @click="toScl">
    <view class="ad-wrapper" :style="{'background-image':`url(${bgImg})`}">
      <view class="ad-box">
        <image class="img" :src="adImg" mode="widthFix"></image>
      </view>
      <view
      class="btn-box"
      :style="{'background-image':`url(${staticImgs.btnBg})`}"
      >
        获取我的{{(adCode == 'spm' || adCode == 'sbis') ? 'IQ' : 'EQ'}}
      </view>
    </view>
  </view>
</template>

<script>
  export default{
    props:{
      bgType:{
        type:String,
        default:'iq'
      },
      adSclId:{
        type:String,
        default:''
      },
      adCode:{
        type:String,
        default:'spm'
      },
    },
    data(){
      return {
        staticImgs:{
          eqBg: this.imgBaseURL + '/scl/ad/common/ad-block-bg-eq.png',
          iqBg: this.imgBaseURL + '/scl/ad/common/ad-block-bg-iq.png',
          
          sbis: this.imgBaseURL + '/scl/ad/common/ad-sbis-img.png',
          tmms: this.imgBaseURL + '/scl/ad/common/ad-tmms-img.png',
          spm: this.imgBaseURL + '/scl/ad/common/ad-spm-img.png',
          btnBg: this.imgBaseURL + '/scl/scl-before-result-page/iq-spm/btn-bg.jpg',
        },
      }
    },
    computed:{
      bgImg(){
        return this.bgType == 'eq' ? this.staticImgs.eqBg : this.staticImgs.iqBg
      },
      adImg(){
        return this.staticImgs[this.adCode]
      }
    },
    methods:{
      toScl(){
        uni.navigateTo({
          url: '/subcontractorC/pages/sclIntroduce/sclIntroduce?paramObj=' + JSON.stringify({
            sclId: this.adSclId,
          })
        })
      }
    },
  }
</script>

<style lang="scss" scoped>
  .ad-block-comp{
    .ad-wrapper{
      width: 680rpx;
      height: 538rpx;
      background-repeat: no-repeat;
      background-size: 100% 100%;
      
      margin: auto;
          display: flex;
          /* justify-content: center; */
          align-items: center;
          flex-direction: column;
      
      
      .ad-box{
        width: 600rpx;
        height: 280rpx;
        margin-top: 120rpx;
        
        .img{
          width: 100%;
          height: 100%;
        }
        
      }
      
      .btn-box{
        background-repeat: no-repeat;
        background-size: 100% 100%;
        
        margin-top: 22rpx;
        
        width: 340rpx;
        height: 94rpx;
        // background: linear-gradient( 180deg, #FFE35C 0%, #FFC559 18%, #FF8D00 53%, #F4BF59 100%);
        border-radius: 46rpx;
        
        font-family: PingFang-SC, PingFang-SC;
        font-weight: bold;
        font-size: 32rpx;
        color: #FFFFFF;
        // line-height: 45rpx;
        text-align: center;
        font-style: normal;
        box-sizing: border-box;
        padding-top: 20rpx;
        
      }
    }
  }
</style>